package com.playtech.tournament.balancing.test.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;

public class Seat extends Composite {
	private Player player;
	private FlowPanel fp = new FlowPanel();
	private Label empty = new Label("Empty");

	public Seat() {
		this(null);
	}

	public Seat(Player player) {
		this.player = player;
		if (player != null) {
			fp.add(player);
		} else {
			fp.add(empty);
		}
		initWidget(fp);
		setStyleName("floatLeft");
		addStyleName("seat");

	}

	public Player getPlayer() {
		return player;
	}
	
	public void seatPlayer(Player player) {
		fp.clear();
		fp.add(player);
		this.player = player;
	}

	public void removePlayer() {
		fp.clear();
		fp.add(empty);
		this.player = null;
	}
	
	public boolean hasPlayer() {
		return player != null;
	}
}
